//
//  UIBarButtonItem+Button.swift
//  555wobo
//
//  Created by 黄某某 on 15/12/20.
//  Copyright © 2015年 黄某某. All rights reserved.
//

import UIKit
extension UIBarButtonItem {
    convenience init(imageName: String){
        let highlightedImageName = imageName + "_highlighted"
        let btn = UIButton()
        btn.setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        btn.setImage(UIImage(named: highlightedImageName), forState: UIControlState.Highlighted)
        btn.sizeToFit()
        self.init(customView:btn)
    }
    class func createBarButtonItem(imageName: String) -> UIBarButtonItem{
        let highlightedImageName = imageName + "_highlighted"
        let btn = UIButton()
        btn.setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        btn.setImage(UIImage(named: highlightedImageName), forState: UIControlState.Highlighted)
        btn.sizeToFit()
        return UIBarButtonItem(customView: btn)
    }
    
    
    
    
    
    
    
    
}
